#include "Car.h"
#include "GameManager.h"
#include "CEMoveBySpeed.h"
#include "Road.h"
#include "GameConst.h"

float Car::width = 1.7*METTER_TO_POINT;
float Car::length = 4.7*METTER_TO_POINT;

Car::Car()
{
	setTag(ID_CAR);
}

Car::~Car()
{
}

bool Car::init(){
	Vehicle::init();
    
    width = 1.7*METTER_TO_POINT;
    length = 4.7*METTER_TO_POINT;

	mainSprite = CCSprite::createWithSpriteFrameName("Car.png");
	mainSprite->setAnchorPoint(ccp(0, 0));
	addChild(mainSprite);

    float realSizeX = Car::length;
	float scaleFactorX = realSizeX/mainSprite->boundingBox().size.width;
	mainSprite->setScaleX(scaleFactorX);

    float realSizeY = Car::width;
	float scaleFactorY = realSizeY/mainSprite->boundingBox().size.height;
	mainSprite->setScaleY(scaleFactorY);

	setContentSize(mainSprite->boundingBox().size);

	return true;
}